(function($){
	
	var positionMap = {
		top: 1,
		right: 2,
		down: 3,
		left: 4
	};
	
	//默认显示error方式
	$.validator.setDefaults({
		showErrors: function(map, list) {
			var msg="";
			$.each(list, function(index, error) {
				msg+="</br>"+error.message;
				return true;
			});
			if(msg!=""){
				apexLayer.Warn(msg,null,true);
			}
		},
		//禁用实时校验
		actualCheck:false
	});
	
	$.validator.addMethod("jymm", function(value, element) {
		var flag = apexValidate.isJymm(value);
		return this.optional(element) || flag;
	});
	$.validator.addMethod("mobile", function(value, element) {
		var flag = apexValidate.isMobilePhone(value);
		return this.optional(element) || flag;
	});
	$.validator.addMethod("yzbm", function(value, element) {
		var flag = apexValidate.isYzbm(value);
		return this.optional(element) || flag;
	});
	$.validator.addMethod("maxlength_CN", function(value, element, param) {
		return this.optional(element) || !apexValidate.isChinessCharExceed(value, param);
	});
	$.validator.addMethod("fax", function(value, element, param) {
		var flag = apexValidate.isFax(value);
		return this.optional(element) || flag;
	});
	$.validator.addMethod("yzm", function(value, element, param) {
		var flag = apexValidate.isYzm(value);
		return this.optional(element) || flag;
	});
	$.validator.addMethod("mobilesStrSplitByDot", function(value, element, param) {
		var flag = apexValidate.isMobilesStrSplitByDot(value);
		return this.optional(element) || flag;
	});
	
}(jQuery));